<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>修改网站设置 - bjyadmin</title>
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap/dist/css/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/animate.css/animate.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/font-awesome/css/font-awesome.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/simple-line-icons/css/simple-line-icons.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap-editable/css/bootstrap-editable.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/app/css/font.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/app/css/app.css" type="text/css" />
    <webuploadercss/>
</head>
<body>
<div class="wrapper-md">
   <div class="panel panel-default">
    <div class="panel-heading">
        <a href=""><i class="fa fa-home"></i>&nbsp;首页</a>&nbsp;&gt;&nbsp;&nbsp;网站设置
    </div>
    <div class="table-responsive">
        <form class="form-horizontal" action="{:U('Admin/Config/save',array('type'=>webInfo))}" method="post">
            <ul class="nav nav-tabs text-center" role="tablist">
                <li role="presentation" class="active"><a href="#web" aria-controls="web" role="tab" data-toggle="tab">网站信息</a></li>
                <li role="presentation"><a href="#company" aria-controls="company" role="tab" data-toggle="tab">公司信息</a></li>
                <li role="presentation"><a href="#statistics" aria-controls="statistics" role="tab" data-toggle="tab">统计代码</a></li>
            </ul>
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active" id="web">
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">网站域名：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="web_domain" value="{$data['web_domain']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">网站标题：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="web_title" value="{$data['web_title']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">网站描述：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="web_info" value="{$data['web_info']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                      <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">网站关键字：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="web_keywords" value="{$data['web_keywords']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">ICP备案号：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="web_icp" value="{$data['web_icp']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                      <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">网站是否关闭：</label>
                        <div class="col-sm-6">
                            <div class="radio">
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="web_is_close" value="0" <if condition="$data['web_is_close'] eq 0">checked</if>>
                                    <i></i>否
                                </label>
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="web_is_close" value="1" <if condition="$data['web_is_close'] eq 1">checked</if>>
                                    <i></i>是
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">网站关闭提示语：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="web_prompt" value="{$data['web_prompt']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">企业口号：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="web_slogan" value="{$data['web_slogan']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">默认入口：</label>
                        <div class="col-sm-6">
                            <select class="input-sm form-control w-sm inline v-middle m-r" name="web_index">
                                <option value="0">请选择</option>
                                <volist name="list" id="c">
                                    <option value="{$c['mca']}" <if condition="$data['web_index'] eq $c['mca']">selected</if>>{$c['name']}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                </div>
                <div role="tabpanel" class="tab-pane" id="company">
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">公司名称：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="company_name" value="{$data['company_name']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">公司简介：</label>
                        <div class="col-sm-6">
                            <textarea class="form-control" name="company_desc" rows="5">{$data['company_desc']}</textarea>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">公司地址：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="company_address" id="address" value="{$data['company_address']}" data-form-un="1470118834084.755">
                        </div>
                        <div class="col-sm-2">
                            <button type="button" onclick="edit()" class="btn btn-default">搜索</button>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">经度：</label>
                        <div class="col-sm-2">
                            <input type="text" class="form-control" name="company_lng" id="lng" value="{$data['company_lng']}" data-form-un="1470118834084.755">
                        </div>
                        <label class="col-sm-2 control-label" for="input-id-1">纬度：</label>
                        <div class="col-sm-2">
                            <input type="text" class="form-control" name="company_lat" id="lat" value="{$data['company_lat']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">地图：</label>
                        <div class="col-sm-6">
                            <div id="allmap" style="width:100%;height:300px;"></div>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">公司电话：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="company_phone" value="{$data['company_phone']}" data-form-un="1470118834084.755">
                        </div>
                    </div>            
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">公司传真：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="company_fax" value="{$data['company_fax']}" data-form-un="1470118834084.755">
                        </div>
                    </div>            
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">公司邮件：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="company_email" value="{$data['company_email']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">微博：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="weibo" value="{$data['weibo']}" data-form-un="1470118834084.755">
                            <span>请以“http://”开头</span>
                        </div>
                    </div>
                    <if condition="$data['wechat_qrcode']">
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group m-b-none m-l-none m-r-none">
                            <label class="col-sm-2 control-label" for="input-id-1">公众号二维码：</label>
                            <div class="col-sm-6">
                                <img src="{$data['wechat_qrcode']}" height="100" width="100">
                            </div>
                        </div>
                    </if>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">公众号二维码：</label>
                        <div class="col-sm-6">
                             <!-- 上传组件容器 开始-->
                            <div id="wechat_qrcode_upload" class="xb-uploader">
                                <div class="queueList">
                                    <div class="placeholder">
                                        <div class="filePicker"></div>
                                        <p>上传二维码</p>
                                    </div>
                                </div>
                                <div class="statusBar" style="display:none;">
                                    <div class="progress">
                                        <span class="text">0%</span>
                                        <span class="percentage"></span>
                                    </div>
                                    <div class="info"></div>
                                    <div class="btns">
                                        <div class="uploadBtn">开始上传</div>
                                    </div>
                                </div>
                                <input type="hidden" name="wechat_qrcode" value="{$data['wechat_qrcode']}" />
                            </div>
                            <!-- 上传组件容器 结束-->
                        </div>
                    </div>
                    <if condition="$data['service_qrcode']">
                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group m-b-none m-l-none m-r-none">
                            <label class="col-sm-2 control-label" for="input-id-1">服务二维码：</label>
                            <div class="col-sm-6">
                                <img src="{$data['service_qrcode']}" height="100" width="100">
                            </div>
                        </div>
                    </if>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">客服二维码：</label>
                        <div class="col-sm-6">
                             <!-- 上传组件容器 开始-->
                            <div id="service_qrcode_upload" class="xb-uploader">
                                <div class="queueList">
                                    <div class="placeholder">
                                        <div class="filePicker"></div>
                                        <p>上传二维码</p>
                                    </div>
                                </div>
                                <div class="statusBar" style="display:none;">
                                    <div class="progress">
                                        <span class="text">0%</span>
                                        <span class="percentage"></span>
                                    </div>
                                    <div class="info"></div>
                                    <div class="btns">
                                        <div class="uploadBtn">开始上传</div>
                                    </div>
                                </div>
                            </div>
                            <input type="hidden" name="service_qrcode" value="{$data['service_qrcode']}" />
                            <!-- 上传组件容器 结束-->
                        </div>
                    </div>                      
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">QQ：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="qq" value="{$data['qq']}" data-form-un="1470118834084.755">
                            <span>多个QQ请用 , 隔开</span>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">客服电话：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="service_phone" value="{$data['service_phone']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">售前电话：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="presales_phone" value="{$data['presales_phone']}" data-form-un="1470118834084.755">
                        </div>
                    </div>
                </div>
                <div role="tabpanel" class="tab-pane" id="statistics">
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">百度统计：</label>
                        <div class="col-sm-6">
                            <textarea class="form-control" name="statistics_baidu" rows="5" maxlength="">{$data['statistics_baidu']}</textarea>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">百度自动推送：</label>
                        <div class="col-sm-6">
                            <textarea class="form-control" name="push_baidu" rows="5" maxlength="">{$data['push_baidu']}</textarea>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">360统计：</label>
                        <div class="col-sm-6">
                            <textarea class="form-control" name="statistics_360" rows="5" maxlength="">{$data['statistics_360']}</textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="col-sm-4 col-sm-offset-2 m-b">
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </form>
    </div>
  </div>
</div>
<div class="modal fade" id="bjy-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
         <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    查看二维码
                </h4>
            </div>
            <div class="modal-body">
                <img src='' class="b b-a wrapper-xs bg-white img-responsive">
            </div>
        </div>
    </div>
</div>
<script src="__ADMIN_STATICS__/jquery/jquery.min.js"></script>
<script src="__ADMIN_STATICS__/bootstrap/dist/js/bootstrap.js"></script>
<script src="__ADMIN_STATICS__/webuploader-0.1.5/webuploader.js"></script>
<script src="__ADMIN_STATICS__/webuploader-0.1.5/uploaderSf.js"></script>  
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Q0AWXP9FNzYvVy6zRAGy8sKs7lWzAZO7"></script>
<script type="text/javascript">
var address = $("#address").val();
var lng = $("#lng").val();
var lat = $("#lat").val();
if(address == '' || lng == '' || lat == ''){
    var point = new BMap.Point(116.404, 39.915);
}
if(lng != '' && lat != ''){
    var point = new BMap.Point(lng,lat);
}
// 百度地图API功能
var map = new BMap.Map("allmap",{minZoom:10,maxZoom:20});            // 创建Map实例
  // 添加带有定位的导航控件
var navigationControl = new BMap.NavigationControl({
    // 靠左上角位置
    anchor: BMAP_ANCHOR_TOP_LEFT,
    // LARGE类型
    type: BMAP_NAVIGATION_CONTROL_LARGE,
    // 启用显示定位
    enableGeolocation: true
});
map.addControl(navigationControl);
map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放

var marker = new BMap.Marker(point);  // 创建标注
map.addEventListener("click", function(e){
    var point = new BMap.Point(e.point.lng,e.point.lat);
    map.clearOverlays();
    map.addOverlay(new BMap.Marker(point));
    setPoint(point);
});
map.addOverlay(marker);               // 将标注添加到地图中
map.centerAndZoom(point, 20);

function edit(obj){
    // 创建地址解析器实例
    var myGeo = new BMap.Geocoder();
    var param = $('#address').val();
    myGeo.getPoint(param, function(point){      
          if (point) {      
                map.centerAndZoom(point, 20);
                map.clearOverlays();      
                map.addOverlay(new BMap.Marker(point));
                setPoint(point);      
          }      
      }, "南宁市");
}

function setPoint(point){
    var lng = point.lng;
    var lat = point.lat;
    $('#lng').val(lng);
    $('#lat').val(lat);
}

// function preview(){
//     var path = $("input[name='wechat_qcode']").val();
//     $('#bjy-edit img').attr('src', path);
//     $('#bjy-edit').modal('show');
// }

$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
    // 获取已激活选项卡的名称
    var activeTab = $(e.target).attr('aria-controls');
    if(activeTab == "company"){
        // 初始化上传组件
        upload_init('wechat_qrcode',false,'image');
        upload_init('service_qrcode',false,'image');
    }
});

function upload_init(activeTab,multiple,type){
    console.log(activeTab);
    if (type == "image"){
        sizeLimit = 1;
    }else{
        sizeLimit = 50;
    }
    $('#'+activeTab+'_upload').sfUpload({
        url:"{:U('Admin/Config/upload')}",
        picker:activeTab+'_upload',
        multiple:multiple,
        sizeLimit:sizeLimit,
        success:function( data ) {
            $("input[name='"+activeTab+"']").val(data['path']);
        },
        error:function( err ) {
            console.info( err );    
        }
    });
}

</script>
</body>
</html>
